<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


use App\Http\Controllers\AuthController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\SpeakerController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

/**
 * JWT 用户鉴权基础路由.
 * laravel-box定义.
 */
Route::group(
    [
        'prefix' => 'auth',
        'middleware' => ['allow', 'refresh']
    ],
    function ($router) {
        $router->post('logout', [AuthController::class, 'logout']);
        $router->post('refresh', [AuthController::class, 'refresh']);
        $router->post('me', [AuthController::class, 'me']);
        $router->post('follow', [AuthController::class, 'followList']); // 我的关注列表
    }
);

Route::group(
    [
        'prefix' => 'auth',
        'middleware' => ['allow'], // 允许跨域
    ],
    function ($router) {
        $router->post('login', [AuthController::class, 'login']);
        $router->post('register', [AuthController::class, 'register']);
        $router->post('forget', [AuthController::class, 'forgetPassword']); // 忘记密码
        $router->post('sms', [AuthController::class, 'sendCode']); // 发送验证码
        $router->post('upload', [AuthController::class, 'upload']); // 上传图片
        $router->get('test/pdf', [AuthController::class, 'testPdf']);
    }
);



Route::group(
    [
        'prefix' => 'home',
        'middleware' => ['allow'], // 允许跨域
    ],
    function ($router) {
        // 精选文章
        $router->get('articles', [HomeController::class, 'featuredArticles']);
        // 精选视频
        $router->get('video', [HomeController::class, 'featuredVideo']);
    }
);
